home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9450 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
  2. From: thay@uoguelph.ca (Toby K Hay)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Segmentation Fault ???
  5. Date: 10 Mar 1996 19:33:23 GMT
  6. Organization: University of Guelph
  7. Message-ID: <4hvaq3$n8f@ccshst05.cs.uoguelph.ca>
  8. References: <4hsa7i$en3@wraith.its.uow.edu.au> <4huis1$cm2@ccshst05.cs.uoguelph.ca> <4hv75jINNpss@keats.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Kazimir Kylheku (c2a192@ugrad.cs.ubc.ca) wrote:
  13.  
  14. : It means that you are making errors in your code that the Turbo C environment
  15. : doesn't catch. The bus error is likely caused by invoking
  16. : implementation-specific behavior that is in contravention to standard C:
  17. : converting a pointer to one that has a stricter alignment. On many of the
  18. : processors used in UNIX workstations, the address of a long word has to be
  19. : divisible by four. On a 68000 processor, the address of a 16-bit word has to be
  20. : divisible by two.
  21. : If you fail to meet these alignment restrictions, the hardware will trigger an
  22. : exception, and the UNIX kernel will send a SIGBUS signal to your program.
  23.  
  24. Would lint catch this for me, or will I have to learn about alignment 
  25. restrictions to run my program?
  26.  
  27. : A ``segmentation fault'', (SIGSEGV signal), on the other hand, is caused by
  28. : accessing illegal memory, such as dereferencing a null pointer, reaching past
  29. : the limits of your malloc heap or stack and so forth.
  30.  
  31. From three replies I received via E-mail I understand that accessing 
  32. illegal memory is almost certainly caused by using uninitialized pointers 
  33. - something I will check my code for again.  But what determines the 
  34. limits of my malloc heap, stack, and so forth?  Can I request more memory 
  35. for these at the command line when I start the program?
  36. Toby Hay    thay@uoguelph.ca
  37.